package cn.cai.pethome.emp.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private AuthenticationInterceptor authenticationInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authenticationInterceptor)
                .addPathPatterns("/**")  //拦截所有请求
                .excludePathPatterns("/lr/**","/fastdfs/**","/verifyCode/**")//需要放行的请求
                .excludePathPatterns("/front/**"); //前台用户访问某些资源无需登录，更不需要校验权限
    }
}
